package com.financial.service.yspay.controller;

import com.financial.service.yspay.service.FinancialYsCallBackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;

@RestController
@RequestMapping("/callback")
public class FinancialYsCallBackController {
    @Autowired
    private FinancialYsCallBackService financialYsCallBackService;

    /**
     * @return
     * @Description 银盛微信支付回调地址
     * @Param
     **/
    @PostMapping("/pay/wechat")
    public void weChatCallBack(@RequestParam Map<String, String> paramMap, HttpServletResponse response) {
        financialYsCallBackService.weChatCallBack(paramMap, response);
    }

    /**
     * 银盛支付宝支付回调地址
     * @param paramsMap
     * @param response
     */
    @PostMapping("/pay/aliPay")
    public void aliPayCallBack(@RequestParam Map<String,String> paramsMap,HttpServletResponse response){
        financialYsCallBackService.aliPayCallBack(paramsMap,response);
    }

    /**
     * 银盛分账回调地址
     * @param paramsMap
     * @param response
     */
    @PostMapping("/split")
    public void splitCallBack(@RequestParam Map<String,String> paramsMap,HttpServletResponse response){
        financialYsCallBackService.splitCallBack(paramsMap,response);
    }

    /**
     * 银盛提现回调地址
     * @param paramsMap
     * @param response
     */
    @PostMapping("/withdrawal")
    public void withdrawalCallBack(@RequestParam Map<String,String> paramsMap,HttpServletResponse response){
        financialYsCallBackService.withdrawalCallBack(paramsMap,response);
    }

    /**
     * 银盛代付回调地址
     * @param request
     * @param response
     */
    @PostMapping("/payment")
    public void paymentCallBack(@RequestParam HttpServletRequest request, HttpServletResponse response){
        financialYsCallBackService.paymentCallBack(request,response);
    }
}
